package com.sgb.capital.view.ui.adapter;

import android.graphics.Paint;
import android.view.View;
import android.widget.TextView;

import com.sgb.capital.R;
import com.sgb.capital.model.Bean;
import com.sgb.capital.view.widget.BaseRecyclerViewAdapterHelper.BaseQuickAdapter;
import com.sgb.capital.view.widget.BaseRecyclerViewAdapterHelper.viewholder.BaseViewHolder;

import java.util.List;

public class AsiaRecordDetailsAdapter extends BaseQuickAdapter<Bean, BaseViewHolder> {
    public int type;
    public int refundType = 2;  // 退票类型 1.红冲 2.直接作废

    public AsiaRecordDetailsAdapter(List<Bean> data) {
        super(R.layout.asiarecorddetails_adapter, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Bean item) {
        helper
                .setText(R.id.tv_type, item.no)
                .setText(R.id.tv_value, item.no.contains("原因") ? "" : item.name);

        TextView tv_type = helper.getView(R.id.tv_type);
        TextView tv_value = helper.getView(R.id.tv_value);
        if ((tv_type.getText().toString().equals("发票号码") || tv_type.getText().toString().equals("发票代码")) && type == 9 && refundType == 2) {
            tv_value.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        }
        TextView tv_show = helper.getView(R.id.tv_show);
        if (item.no.contains("原因")) {
            tv_show.setText(item.name);
            tv_show.setVisibility(View.VISIBLE);
        } else {
            tv_show.setVisibility(View.GONE);
        }
    }
}